package com.chanyachting.emall.form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

import com.chanyachting.emall.util.RequestUtil;

public class AdminForm extends ActionForm {
	
	
	// primary key
	private java.lang.Integer id;

	// fields
	private java.lang.String password;
	private java.lang.String type;
	private java.lang.String account;
	
	
	
	
	@Override
	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {
		
		ActionErrors errors=new ActionErrors();
		
		RequestUtil ru=new RequestUtil(request);
		
		if(this.getAccount()==null || this.getAccount().trim().equals("")){
			
			errors.add("adminError",new ActionMessage(""));
			
			ru.setMsg("Account must not null!");
			
		}
		
		if(this.getPassword()==null || this.getPassword().trim().equals("")){
			
			errors.add("adminError",new ActionMessage(""));
			
			ru.setMsg("Password must not null!");
		}
		
		return errors;
		
		
	}
	
	
	
	public java.lang.Integer getId() {
		return id;
	}
	public void setId(java.lang.Integer id) {
		this.id = id;
	}
	public java.lang.String getPassword() {
		return password;
	}
	public void setPassword(java.lang.String password) {
		this.password = password;
	}
	public java.lang.String getType() {
		return type;
	}
	public void setType(java.lang.String type) {
		this.type = type;
	}
	public java.lang.String getAccount() {
		return account;
	}
	public void setAccount(java.lang.String account) {
		this.account = account;
	}

	
	
	
	
	
	


}
